import request from '@/utils/request';

//登录
export function doLogin({ username, password }) {
	return request.post(`/spad-login/common/userLogin`, {
		data: {
			username,
			password,
		},
	});
}

//获取用户信息
export function getUserInfo() {
	return request.post(`/spad-base/back/user/getUserInfo`);
}

//获取年级列表
export function getGradeList() {
	return request.get(`/spad-base/pad/homepage/getGradeList`);
}

//获取学员来源列表
export function getStuSourceList() {
	return request.get(`/spad-base/back/stuSource/getStuSourceList`);
}

//添加学员来源
export function addStuSource(name) {
	return request.post(`/spad-base/back/stuSource/addStuSource`, {
		data: {
			name,
		},
	});
}

//修改学员来源
export function modifyStuSource(params) {
	return request.put(`/spad-base/back/stuSource/updateStuSource`, {
		data: {
			...params,
		},
	});
}

//删除学员来源
export function delStuSource(id) {
	return request.delete(`/spad-base/back/stuSource/deleteStuSource?id=${id}`);
}

//获取科目列表 [简单版本]
export function getSubjectList() {
	return request(`/spad-base/back/setup/findSubjectList`);
}

//获取科目列表 [完整版本]
export function getSubjectList2() {
	return request(`/spad-base/back/setup/findSubjectSetUpList`);
}

//获取视频点播凭证，optionData
export const getVideoAuth = optionData => {
	return request(`/rc-service/ali/createUploadVideo?title=${optionData.title}&fileName=${optionData.fileName}`);
};

//获取视频点播，签名信息
export const getVideoParam = () => {
	return request(`/rc-service/ali/getVideoParam`);
};

//删除阿里云视频点播,optionData
export const delVideo = optionData => {
	return request(`/rc-service/ali/deleteVideo?videoIds=${optionData.videoId}&type=${optionData.type}`);
};
